negotiator
Class Agent

java.lang.Object
  extended by negotiator.Agent
Direct Known Subclasses:
ABMPAgent, ABMPAgent2, ABMPExactAgent, Agent_K, Agent_K2, AgentFSEGA, AgentSmith, BayesianAgent, BayesianAgentForAuction, BilateralAgent, BOAagent, BRAMAgent, DecUtilAgent, FuzzyAgent, Gahboninho, IAMhaggler2011, KLH, Nozomi, QOAgent, RandomIncreasingUtilAgent, RandomWalkABMPAgent, SimilarityAgent, SimpleAgent, SimpleAgentSavingBidHistory, SimpleAgt2, SimpleANAC2013Agent, SimpleTFTAgent, SlowUIAgent, SouthamptonAgent, TestAgent, TestingAgent, TheNegotiator, UIAgent, UIAgentExtended, ValueModelAgent, Yushu

public abstract class Agent
extends java.lang.Object

A basic negotiation agent. You might want to consider using the BOA framework.

Author:
Dmytro Tykhonov, W.Pasman

Field Summary
 BilateralAtomicNegotiationSession fNegotiation
          Reference to protocol which is set when experimental setup is enabled.
protected  java.util.HashMap<AgentParameterVariable,AgentParamValue> parametervalues
          Deprecated. 
 int sessionNr
          A session can be repeated multiple times.
 int sessionsTotal
          Amount of repetitions of this session, how many times this session is repeated in total.
 java.util.Date startTime
          Deprecated. 
protected  StrategyParameters strategyParameters
          Parameters given to the agent which may be specified in the agent repository.
 Timeline timeline
          Use timeline for everything time-related.
 java.lang.Integer totalTime
          Deprecated. 
 UtilitySpace utilitySpace
          Preference profile of the agent as assigned by the tournamentrunner.
 
Constructor Summary
Agent()
          Empty constructor used to initialize the agent.
 
Method Summary
abstract  Action chooseAction()
          this function is called after ReceiveMessage, with an Offer-action.
 void endSession(NegotiationResult dUtil)
          Method which informs an agent about the utility it received.
 AgentID getAgentID()
           
 java.lang.String getName()
           
 java.util.HashMap<AgentParameterVariable,AgentParamValue> getParameterValues()
          Deprecated. 
 int getSessionNumber()
           
 int getSessionsTotal()
           
 StrategyParameters getStrategyParameters()
           
protected  java.lang.String getUniqueIdentifier()
           
 double getUtility(Bid bid)
          A convenience method to get the discounted utility of a bid.
static java.lang.String getVersion()
           
 void init()
          This method is called by the protocol every time before starting a new session after the internalInit method is called.
 void internalInit(int sessionNr, int sessionsTotal, java.util.Date startTimeP, java.lang.Integer totalTimeP, Timeline timeline, UtilitySpace us, java.util.HashMap<AgentParameterVariable,AgentParamValue> params)
          This method is called by the protocol to initialize the agent with a new session information.
 boolean isUIAgent()
          Determine if this agent is communicating with the user about nego steps.
protected  java.io.Serializable loadSessionData()
          Loads the Serializable data for the agent.
 void parseStrategyParameters(java.lang.String variables)
          Used to parse parameters presented in the agent repository.
 void ReceiveMessage(Action opponentAction)
          informs you which action the opponent did
static boolean restartDataObjectsFolder(java.lang.Object sender)
          Restarts the folder "DataObjects", meaning it deletes all files in it and then creates a new empty folder with the same name.
protected  boolean saveSessionData(java.io.Serializable dataToSave)
          Saves information (dataToSave) about the current session for future loading by the agent, when negotiating again with the specific preference profile referred by "filename".
 void setAgentID(AgentID value)
           
 void setName(java.lang.String pName)
          Sets the name of the agent to the given name.
 void sleep(double fraction)
          Let the agent wait in case of a time-based protocol.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

utilitySpace

public UtilitySpace utilitySpace
Preference profile of the agent as assigned by the tournamentrunner.


startTime

@Deprecated
public java.util.Date startTime
Deprecated. 
Date object specifying when the negotiation started. Use timeline instead.


totalTime

@Deprecated
public java.lang.Integer totalTime
Deprecated. 
Total time which an agent has to complete the negotiation. Use timeline instead.


timeline

public Timeline timeline
Use timeline for everything time-related.


sessionNr

public int sessionNr
A session can be repeated multiple times. This parameter specifies which match we are at in the range [0, totalMatches - 1].


sessionsTotal

public int sessionsTotal
Amount of repetitions of this session, how many times this session is repeated in total.


fNegotiation

public BilateralAtomicNegotiationSession fNegotiation
Reference to protocol which is set when experimental setup is enabled.


parametervalues

@Deprecated
protected java.util.HashMap<AgentParameterVariable,AgentParamValue> parametervalues
Deprecated. 
Parameters given to the agent which may be specified in the agent.


strategyParameters

protected StrategyParameters strategyParameters
Parameters given to the agent which may be specified in the agent repository.

Constructor Detail

Agent

public Agent()
Empty constructor used to initialize the agent. Later on internalInit is called to set all variables.

Method Detail

getVersion

public static java.lang.String getVersion()
Returns:
version of the agent.

init

public void init()
This method is called by the protocol every time before starting a new session after the internalInit method is called. User can override this method.


internalInit

public final void internalInit(int sessionNr,
                               int sessionsTotal,
                               java.util.Date startTimeP,
                               java.lang.Integer totalTimeP,
                               Timeline timeline,
                               UtilitySpace us,
                               java.util.HashMap<AgentParameterVariable,AgentParamValue> params)
This method is called by the protocol to initialize the agent with a new session information.

Parameters:
startTimeP -
totalTimeP -
timeline - keeping track of the time in the negotiation.
us - utility space of the agent for the session.
params - parameters of the agent.

ReceiveMessage

public void ReceiveMessage(Action opponentAction)
informs you which action the opponent did

Parameters:
opponentAction -

chooseAction

public abstract Action chooseAction()
this function is called after ReceiveMessage, with an Offer-action.

Returns:
(should return) the bid-action the agent wants to make.

getName

public java.lang.String getName()
Returns:
name of the agent.

getParameterValues

@Deprecated
public java.util.HashMap<AgentParameterVariable,AgentParamValue> getParameterValues()
Deprecated. 

Returns:
a type of parameters used solely by the BayesianAgent.

setName

public final void setName(java.lang.String pName)
Sets the name of the agent to the given name.

Parameters:
pName - to which the agent's name must be set.

getUtility

public double getUtility(Bid bid)
A convenience method to get the discounted utility of a bid. This method will take discount factors into account (if any), using the status of the current timeline.

Parameters:
bid - of which we are interested in the utility.
Returns:
discounted utility of the given bid.
See Also:
UtilitySpace

sleep

public void sleep(double fraction)
Let the agent wait in case of a time-based protocol. Example:
sleep(0.1) will let the agent sleep for 10% of the negotiation time (as defined by the Timeline).

Parameters:
fraction - should be between 0 and 1.

isUIAgent

public boolean isUIAgent()
Determine if this agent is communicating with the user about nego steps.

Returns:
true if a human user is directly communicating with the agent in order to steer the nego. This flag is used to determine the timeout for the negotiation (larger with human users).

endSession

public void endSession(NegotiationResult dUtil)
Method which informs an agent about the utility it received.

Parameters:
dUtil - discounted utility of previous session round.

getAgentID

public AgentID getAgentID()
Returns:
ID of the agent as assigned by the protocol.

setAgentID

public void setAgentID(AgentID value)
Parameters:
value - to which the agent's ID must be set.

getStrategyParameters

public StrategyParameters getStrategyParameters()

parseStrategyParameters

public void parseStrategyParameters(java.lang.String variables)
                             throws java.lang.Exception
Used to parse parameters presented in the agent repository. The particular implementation below parses parameters such as time=0.9;e=1.0.

Parameters:
variables -
Throws:
java.lang.Exception

getSessionNumber

public int getSessionNumber()
Returns:
which session we are in. If a session is first started it is zero.

getSessionsTotal

public int getSessionsTotal()
Returns:
total sessions. How many times the session is repeated.

saveSessionData

protected final boolean saveSessionData(java.io.Serializable dataToSave)
Saves information (dataToSave) about the current session for future loading by the agent, when negotiating again with the specific preference profile referred by "filename". Important: 1) The dataToSave must implement Serializable interface. This is to make sure the data can be saved. 2) If the function is used more than once regarding the same preference profile, it will override the data saved from last session with the new Object "dataToSave".

Parameters:
dataToSave - the data regarding the last session that "agent" wants to save.
Returns:
true if dataToSave is successfully saved, false otherwise.

getUniqueIdentifier

protected java.lang.String getUniqueIdentifier()
Returns:
unique identifier of the Agent object.

loadSessionData

protected final java.io.Serializable loadSessionData()
Loads the Serializable data for the agent. If the function "saveSessionData" wasn't used for this type of agent with the current preference profile of the agent - the data will be null. Otherwise, it will load the saved data of the agent for this specific preference profile.

Returns:
the Serializable data if the load is successful, null otherwise.

restartDataObjectsFolder

public static boolean restartDataObjectsFolder(java.lang.Object sender)
Restarts the folder "DataObjects", meaning it deletes all files in it and then creates a new empty folder with the same name.

Parameters:
sender - the Object trying to reset DataObjectFolder NOTE: only TournamentRunner is allowed to apply this procedure.
Returns:
true if succeeded